package com.jlect.swebing.ui.client;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * Redirector for the mouse events
 *
 * @author Sergey Kozmin
 * @since 23.11.2007 23:18:17
 */
public class MouseListenerCollection extends ArrayList {
    public void fireEvent(MouseEvent event) {
        for (Iterator iterator = iterator(); iterator.hasNext();) {
            MouseListener listener = (MouseListener) iterator.next();
            switch (event.getMouseType()) {
                case MouseEvent.MOUSE_DOWN : {
                    listener.mousePressed(event);
                    break;
                }
                case MouseEvent.MOUSE_UP : {
                    listener.mouseReleased(event);
                    break;
                }
                case MouseEvent.CLICK_EVENT : {
                    listener.mouseClicked(event);
                    break;
                }
                case MouseEvent.MOUSE_OUT : {
                    listener.mouseExited(event);
                    break;
                }
                case MouseEvent.MOUSE_OVER : {
                    listener.mouseEntered(event);
                    break;
                }
            }
        }
    }
}
